home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / QT2MPEG.ZIP / xanim.diff < prev   
Text File  |  1994-12-27  |  6KB  |  202 lines

  1. diff -u xanim2693/Imakefile qt/Imakefile
  2. --- xanim2693/Imakefile    Tue Aug  2 06:30:27 1994
  3. +++ qt/Imakefile    Fri Aug 12 09:59:10 1994
  4. @@ -18,7 +18,7 @@
  5.  XCOMM
  6.  XCOMM (((((Status changed to RECOMMENDED)))).
  7.  XCOMM
  8. -XA_AUDIO_DEFS = -DXA_SPARC_AUDIO -DXA_AUDIO_ITIMER
  9. +XCOMM XA_AUDIO_DEFS = -DXA_SPARC_AUDIO -DXA_AUDIO_ITIMER
  10.  XCOMM
  11.  XCOMM -- SPARC Workstations Solaris
  12.  XCOMM XA_AUDIO_DEFS = -DXA_SPARC_AUDIO -DXA_AUDIO_ITIMER -DSOLARIS
  13. diff -u xanim2693/xanim.c qt/xanim.c
  14. --- xanim2693/xanim.c    Tue Aug  2 06:30:25 1994
  15. +++ qt/xanim.c    Thu Aug 11 07:50:06 1994
  16. @@ -207,6 +207,7 @@
  17.  }
  18.  #endif
  19.  
  20. +int ppmdump= 0, audump= 0, rawdump= 0;
  21.  
  22.  /*
  23.   * Global X11 display configuation variables
  24. @@ -862,6 +863,23 @@
  25.     {
  26.       LONG len,opt_on;
  27.  
  28. +     if (!strcmp(argv[i]+1,"au")) {
  29. +       xa_audio_enable= TRUE;
  30. +       audump= 1;
  31. +       continue;
  32. +     }
  33. +     if (!strcmp(argv[i]+1,"raw")) {
  34. +       xa_audio_enable= TRUE;
  35. +       rawdump= 1;
  36. +       continue;
  37. +     }
  38. +     if (!strcmp(argv[i]+1,"ppm")) {
  39. +       xa_buffer_flag    = TRUE;  cmap_true_to_1st   = FALSE;
  40. +       cmap_true_to_gray = FALSE; cmap_true_to_332   = FALSE;
  41. +       cmap_true_to_all  = TRUE;  cmap_true_map_flag = TRUE;
  42. +       ppmdump= 1;
  43. +       continue;
  44. +     }
  45.       if (in[0] == '-') opt_on = FALSE;
  46.       else opt_on = TRUE;
  47.       /* if + turns off then reverse opt_on */
  48. diff -u xanim2693/xanim.h qt/xanim.h
  49. --- xanim2693/xanim.h    Tue Aug  2 06:30:25 1994
  50. +++ qt/xanim.h    Thu Aug 11 08:22:07 1994
  51. @@ -89,6 +89,8 @@
  52.  #define XA_X11_TRUE    0x08
  53.  #define XA_X11_COLOR    0x10
  54.  
  55. +extern int ppmdump, audump, rawdump;
  56. +
  57.  extern LONG x11_depth;
  58.  extern LONG x11_class;
  59.  extern LONG x11_bytes_pixel;
  60. diff -u xanim2693/xanim_audio.c qt/xanim_audio.c
  61. --- xanim2693/xanim_audio.c    Tue Aug  2 06:30:25 1994
  62. +++ qt/xanim_audio.c    Thu Aug 11 08:13:08 1994
  63. @@ -1356,6 +1356,8 @@
  64.      }
  65.    }
  66.  
  67. +  if (audump) xa_audio_hard_type = XA_AUDIO_SUN_AU;
  68. +
  69.    /* Figure out which conversion routine to use */
  70.    switch(xa_audio_hard_type)
  71.    {
  72. diff -u xanim2693/xanim_cmap.c qt/xanim_cmap.c
  73. --- xanim2693/xanim_cmap.c    Tue Aug  2 06:30:26 1994
  74. +++ qt/xanim_cmap.c    Thu Aug 11 08:15:13 1994
  75. @@ -1103,6 +1103,25 @@
  76.    XA_CHDR *new_chdr;
  77.    ULONG *clist,clist_len,wanted_csize;
  78.    register ULONG i,rshift,gshift,bshift;
  79. +  FILE *fdump;
  80. +  char dname[20];
  81. +  static int di= 0;
  82. +  if (ppmdump) {
  83. +    if (di>10) {
  84. +      sprintf(dname,"dump_%d.ppm",di-10);
  85. +      while (fdump= fopen(dname,"r")) fclose(fdump);
  86. +    }
  87. +    sprintf(dname,"dump_%d.ppm",di++);
  88. +    fprintf(stderr,"%s\n",dname);
  89. +    fdump= fopen(dname,"wb");
  90. +    if (fdump) {
  91. +      fprintf(fdump,"P6\n%01d %01d\n%01d\n",width,height,255);
  92. +      fwrite(ipic,1,width*height*3,fdump);
  93. +      fclose(fdump);
  94. +      return;
  95. +    }
  96. +  }
  97.  
  98.  /* NOTE: should make sure 2^(rbits+gbits+bbits) is < (width*height) */
  99.  /* optimize for space if so */
  100. diff -u xanim2693/xanim_qt.c qt/xanim_qt.c
  101. --- xanim2693/xanim_qt.c    Tue Aug  2 06:30:26 1994
  102. +++ qt/xanim_qt.c    Fri Aug 12 10:08:57 1994
  103. @@ -1,4 +1,3 @@
  104. -
  105.  /*
  106.   * xanim_qt.c
  107.   *
  108. @@ -303,9 +302,17 @@
  109.      }
  110.    } else strcpy(qt_dfilename,qt_rfilename); /* r file is d file */
  111.  DEBUG_LEVEL1 fprintf(stderr,"reading data\n");
  112. -  QT_Read_Video_Data(fin,anim_hdr);
  113. -  QT_Read_Audio_Data(fin,anim_hdr);
  114. +
  115. +  if ((!rawdump && !audump) || ppmdump) {
  116. +    fprintf(stderr,"reading video data\n");
  117. +    QT_Read_Video_Data(fin,anim_hdr);
  118. +  }
  119. +  if (!ppmdump || rawdump || audump) {
  120. +    fprintf(stderr,"reading audio data\n");
  121. +    QT_Read_Audio_Data(fin,anim_hdr);
  122. +  }
  123.    fclose(fin);
  124. +  if (ppmdump || rawdump || audump) exit(0);
  125.  
  126.    if (xa_verbose) fprintf(stderr,"    Frames %ld\n", qt_frame_cnt);
  127.  
  128. @@ -1479,15 +1486,17 @@
  129.          else if ( (cmap_true_to_gray == TRUE) && (qt_chdr == 0) )
  130.              qt_chdr = CMAP_Create_Gray(qt_cmap,&qt_imagec);
  131.  
  132. -        if (cmap_dither_type == CMAP_DITHER_FLOYD)
  133. -        tpic = UTIL_RGB_To_FS_Map(0,qt_pic,qt_chdr,
  134. -                    qt_imagex,qt_imagey,FALSE);
  135. -        else
  136. -        tpic = UTIL_RGB_To_Map(0,qt_pic,qt_chdr,
  137. -                    qt_imagex,qt_imagey,FALSE);
  138. -        ACT_Setup_Mapped(act,tpic,qt_chdr,xpos,ypos,xsize,ysize,
  139. +            if (!ppmdump) {
  140. +          if (cmap_dither_type == CMAP_DITHER_FLOYD)
  141. +          tpic = UTIL_RGB_To_FS_Map(0,qt_pic,qt_chdr,
  142. +                      qt_imagex,qt_imagey,FALSE);
  143. +          else
  144. +          tpic = UTIL_RGB_To_Map(0,qt_pic,qt_chdr,
  145. +                      qt_imagex,qt_imagey,FALSE);
  146. +          ACT_Setup_Mapped(act,tpic,qt_chdr,xpos,ypos,xsize,ysize,
  147.          qt_imagex,qt_imagey,FALSE,0,TRUE,TRUE,FALSE);
  148. -            ACT_Add_CHDR_To_Action(act,qt_chdr);
  149. +              ACT_Add_CHDR_To_Action(act,qt_chdr);
  150. +            } /* end of not ppmdump */
  151.        } /* end of not NOP */
  152.      } /* end of true_map */
  153.        } /* end of buffer */
  154. @@ -3557,6 +3566,7 @@
  155.    ULONG ret,base_offset,i;
  156.    ULONG cur_s2chunk,nxt_s2chunk;
  157.    ULONG tag;
  158. +  FILE *fau= 0;
  159.  
  160.  DEBUG_LEVEL1 fprintf(stderr,"QT_Read_Audio: attempt %lx co# %ld\n",
  161.                  qt_audio_attempt,qts_chunkoff_num);
  162. @@ -3595,6 +3605,21 @@
  163.    qt_audio_type  = qts_codecs[tag].compression;
  164.    qt_audio_end   = 1;
  165.  
  166. +  if (audump || rawdump) {
  167. +    fprintf(stderr,"Sample Rate: %01u, Channels: %01d, BitsPerSample: %01d\n"
  168. +                  ,qt_audio_freq, qt_audio_chans, qt_audio_bps <<3);
  169. +    if (rawdump) {
  170. +      fau= fopen("xanim.raw","wb");
  171. +      if (fau) fprintf(stderr,"Opened xanim.raw\n");
  172. +      else exit(1);
  173. +    }
  174. +    if (audump) {
  175. +      fau= fopen("xanim.au","wb");
  176. +      if (fau) fprintf(stderr,"Opened xanim.au\n");
  177. +      else exit(1);
  178. +    }
  179. +  }
  180. +
  181.    /* Loop through chunk offsets */
  182.    for(i=0; i < qts_chunkoff_num; i++)
  183.    { UBYTE *snd_data;
  184. @@ -3640,9 +3665,16 @@
  185.      snd_data = (UBYTE *)malloc(snd_size);
  186.      if (snd_data==0) TheEnd1("QT aud_dat: malloc err");
  187.      ret = fread(snd_data, snd_size, 1, fin);
  188. +    if (rawdump) fwrite(snd_data, 1, snd_size, fau);
  189.      if (ret != 1) { fprintf(stderr,"QT: snd rd err\n"); return; }
  190. -    XA_Add_Sound(anim_hdr,snd_data,qt_audio_type, 0, qt_audio_freq,snd_size);
  191. +/*    XA_Add_Sound(anim_hdr,snd_data,qt_audio_type, 0, qt_audio_freq,snd_size);
  192. +    if (audump) {
  193. +      anim_hdr->last_snd->delta(anim_hdr->last_snd,snd_data);
  194. +      fwrite(snd_data, 1, snd_size, fau);
  195. +    }  */
  196.    } /* end of chunk_offset loop */
  197. +  if (fau) { fclose(fau); fau= 0; }
  198. +  if (fau) fprintf(stderr,"\nWrote all Sound chunks\n");
  199.  }
  200.  
  201.